<extend name="Common@Common:layui" />
<block name="title">
    <title>编辑用户</title>
</block>
<block name="style">
    <style>
        .my-title {
            line-height: 38px;
            height: 38px;
            font-size: 16px;
        }
        
        .my-title b {
            color: red;
        }
        
        select {
            height: 38px;
            line-height: 38px;
            border: 1px solid #AAAAAA;
        }
    </style>
</block>

<block name="main">
    <div class="layui-container" style="width:94%;">
        <form class="layui-form close-dialog" action="/user/api/edit.html" method="post" style="margin-top:20px;">
            <div class="layui-form-item">
                <label class="layui-form-label">用户名:</label>
                <div class="layui-input-block">
                    <if condition="$info['id'] and $_SESSION['loginUser']['role'] != 'admin'">
                        <input type="text" class="layui-input" disabled value="{$info.username}" style="background:#f8f8f8;color:#999999;" placeholder="请输入用户名">
                        <else/>
                        <input type="text" class="layui-input" name="username" value="{$info.username}" placeholder="请输入用户名">
                    </if>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码：</label>
                <div class="layui-input-inline">
                    <input type="password" name="password" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">注：默认密码为“123456”</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">手机号：</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" name="mobile" value="{$info.mobile}" placeholder="请输入手机号码">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">真实姓名：</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" name="realname" value="{$info.realname}" placeholder="请输入真实姓名">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">邮箱：</label>
                <div class="layui-input-block">
                    <input type="text" name="email" value="{$info.email}" placeholder="请输入邮箱（选填）" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">是否启用：</label>
                <div class="layui-input-inline">
                    <php>
                        if($info['status'] == ''){ $info['status'] = 1; }
                    </php>
                    <input type="checkbox" name="status" value="1" lay-skin="switch" lay-text="启用|禁用" <if condition="$info['status'] eq 1">checked</if> >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">角色修改</label>
                <div class="layui-input-inline">
                    <php> $roles = ["admin"=>"管理员","base"=>"普通账户"]; </php>
                    <select name="new_role" lay-filter="">
                        <volist name="roles" id="vo">
                            <option value="{$key}" <if condition="$key eq $info['role']">selected</if>>{$vo}</option>
                        </volist>
                    </select>
                </div>
            </div>

            </if>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="hidden" name="id" value="{$info.id}">
                    <input type="hidden" name="role" value="{$info.role}">
                    <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                </div>
            </div>
        </form>
    </div>
</block>
<block name="script">
    <script src="/Public/js/distpicker.data.js"></script>
    <script src="/Public/js/distpicker.min.js"></script>
    <script>
        layui.use(['jquery', 'think'], function() {
            var $ = layui.jquery,
                think = layui.think;

            $('#distpicker2').distpicker({
                province: '---- 所在省 ----',
                city: '---- 所在市 ----',
                district: '---- 所在区 ----'
            });

        });
    </script>
</block>